home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4675 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.0 KB

  1. Path: red.weeg.uiowa.edu!hayhurst
  2. From: Lyle <hayhurst@blue.weeg.uiowa.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: passing pointers to functions
  5. Date: Wed, 31 Jan 1996 10:57:13 -0600
  6. Organization: University of Iowa, Iowa City, IA, USA
  7. Distribution: world
  8. Message-ID: <Pine.A32.3.91.960131105301.69201A-100000@red.weeg.uiowa.edu>
  9. NNTP-Posting-Host: red.weeg.uiowa.edu
  10. Mime-Version: 1.0
  11. Content-Type: TEXT/PLAIN; charset=US-ASCII
  12. X-Sender: hayhurst@red.weeg.uiowa.edu
  13.  
  14.  
  15.  
  16. Hello all, this is a newbie question.
  17.  
  18. I want to pass an empty pointer to a function.  
  19.  
  20.   Inside the function, I create an array.  Then I set the 
  21. pointer_to_array = &A[0].  Finally at the end of the function I return 
  22. the pointer_to_array to my main.
  23.  
  24. void main ()
  25. {
  26.     int *A1 = NULL;
  27.     A1 = MakeArray(A1);
  28.     cout << "First element in Array is" << *A1;
  29. }
  30.  
  31.   My specific question is: what should my function header look like?
  32.   My general question is: what are the rules for passing (and returning) 
  33. pointers to functions w/ call by reference,parameter, and constant reference?
  34.  
  35.   Thanx! --Lyle
  36.  
  37.  
  38.